# encoding: utf-8
"""
@author: 夏洛
@QQ: 1972386194
@file: 06-excel.py
"""


import openpyxl

# pip install openpyxl
import random
# 创建空文件
wb = openpyxl.Workbook()
ws = wb.create_sheet('夏洛',index=0)
'''
数据写入格式
列表嵌套列表
 [[],[],[],[]]
'''

ws.append(['ID','NAME',"AGE"])
for i in range(1,11):
    id = str(i)
    name = str('xialuo' + str(i))
    age = random.randint(18,30)
    ws.append([id,name,age])

wb.save('xl.xlsx')
